package com.boot.business.rabbitmq.service;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component  
public class RabbitMqSend {
	protected static Logger logger=LoggerFactory.getLogger(RabbitMqSend.class); 
	@Autowired  
    private AmqpTemplate rabbitTemplate;  
  
    public String send(String name) {  
        String context = "hello "+name+" --" + new Date();  
        logger.debug("HelloSender: " + context);  
        this.rabbitTemplate.convertAndSend("hello", context);  
        return context;  
    }  
}
